// 
// File:   recommend.h
// Author: ben
//
// Created on October 15, 2008, 1:40 PM
//

#ifndef _RECOMMEND_H
#define	_RECOMMEND_H

#include <stdlib.h>
#include <iostream>
#include <octave-3.0.3/octave/oct.h>
#include <string.h>
#include <fstream>

#include "MyGraphClass.h"

#define MODE_USERS 1
#define MODE_MOVIES 2

using namespace std;

class recommend{
public:
	recommend(int n_users,int n_movies);
	int LoadTest_set(string fname);
	int LoadTraining_set(string fname);
        int LoadTest_set_3lines(string fname);
        int LoadTest_set_3lines_R(string fname);
        int LoadTraining_set_R(string fname);
	
	int SuggestMeSomethingMaxF();
	int SuggestMeSomethingLpUserBased(int k);
	int SuggestMeSomethingLpMovieBased(int k);
	int SuggestMeSomethingLp();
	int SuggestMeSomethingWWtUserBased(int k);
	int SuggestMeSomethingWWtMovieBased(int k);
	int SuggestMeSomethingBinaryUserBased(int k);
	
	double AnalysisDegreeOfAgreement(int index_user);
	double AnalysisPercentile(int index_user);
	double AnalysisRecall(int index_user,int n);

        int PutSuggestionsInFile(string outf);
	// EN TRAVAUX
	int SuggestMeSomethingDWalk(int mode,int k,int inL);
        int SuggestMeSomethingDWalkUserBased(int k,int inL);
        int SuggestMeSomethingDWalkMovieBased(int k,int inL);

private:
	Matrix thistest_set;
	Matrix thistraining_set;
	int thisNusers;
	int thisNmovies;
	
	Matrix thissuggestions_val;
	
	int UserBased(Matrix sim,int k);
	int MovieBased(Matrix sim,int k);
	Matrix ComputeLp();
	
	int RemoveTrainingFromPredictions(int replace);
	int RemoveTrainingFromPredictions(int IndexUser,int replace);
	Matrix ZerosOnDiag(Matrix A);

};



#endif	/* _RECOMMEND_H */

